package com.itheima.String.method;

import java.util.Scanner;

/**
 * @Author 王加鑫
 * @Date 2021/4/27 16:20
 * @Version 1.0
 * 替换敏感词字符,用数组的方式
 */
public class ReplaceTest {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个字符串:");
        String s = sc.nextLine();
        String[] strings = {"TMD","tmd","SB","sb","他妈的","傻逼"};
        StringBuilder sb = new StringBuilder();
        //转化为数组
        for (int i = 0; i < strings.length; i++) {
            if(strings[i] .contains(s)){
                s.replace(strings[i],"**");
                sb.append(s);
            }
        }


        System.out.println(sb);


    }

}
